home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ply15dat.zip / TEXTURE.INC < prev    next >
Text File  |  1992-11-07  |  5KB  |  218 lines

  1. // Names of the various shading flags
  2. define shadow_check       1
  3. define reflect_check      2
  4. define transmit_check     4
  5. define two_sided_surface  8
  6. define cast_shadows      16
  7. define primary_rays      32
  8.  
  9. // Default shading flags during raytracing - everything gets checked.
  10. define all_shading_flags
  11.    shadow_check + reflect_check + transmit_check + cast_shadows +
  12.    two_sided_surface + primary_rays
  13.  
  14. //
  15. // Define a set of shading flags for surfaces that shouldn't have their
  16. // backsided illuminated
  17. define one_sided_surface
  18.    all_shading_flags - two_sided_surface
  19.  
  20. // Useful definitions to use with noise surfaces.  These
  21. // will come in handy below when we declare marble and
  22. // wood textures.
  23. define position_plain       0
  24. define position_objectx     1
  25. define position_worldx      2
  26. define position_cylindrical 3
  27. define position_spherical   4
  28. define position_radial      5
  29.  
  30. define lookup_plain    0
  31. define lookup_sawtooth 1
  32. define lookup_cos      2
  33. define lookup_sin      3
  34.  
  35. define plain_normal  0
  36. define bump_normal   1
  37. define ripple_normal 2
  38. define dented_normal 3
  39.  
  40. define blue_ripple
  41. texture {
  42.    noise surface {
  43.       color <0.4, 0.4, 1.0>
  44.       normal 2
  45.       frequency 100
  46.       bump_scale 2
  47.       ambient 0.3
  48.       diffuse 0.4
  49.       specular white, 0.7
  50.       reflection 0.5
  51.       microfacet Reitz 10
  52.       }
  53.    scale <10, 1, 10>
  54.    }
  55.  
  56. // The standard sort of marble texture
  57. define white_marble
  58. texture {
  59.    noise surface {
  60.       color white
  61.       position_fn position_objectx
  62.       lookup_fn lookup_sawtooth
  63.       octaves 3
  64.       turbulence 3
  65.       ambient 0.3
  66.       diffuse 0.8
  67.       specular 0.3
  68.       microfacet Reitz 5
  69.       color_map(
  70.          [0.0, 0.8, <1, 1, 1>, <0.6, 0.6, 0.6>]
  71.          [0.8, 1.0, <0.6, 0.6, 0.6>, <0.1, 0.1, 0.1>])
  72.       }
  73.    }
  74.  
  75. // Nice blue agate texture
  76. define sapphire_agate
  77. texture {
  78.    noise surface {
  79.       ambient 0.5
  80.       diffuse 0.7
  81.       position_fn position_objectx
  82.       position_scale 1.1
  83.       lookup_fn lookup_sawtooth
  84.       octaves 3
  85.       turbulence 2
  86.       color_map(
  87.          [0.0, 0.3, <0, 0, 0.9>, <0, 0, 0.8>]
  88.          [0.3, 1,   <0, 0, 0.8>, <0, 0, 0.4>])
  89.       }
  90.    scale <0.5, 0.5, 0.5>
  91.    }
  92.  
  93. // Simple color map texture
  94. define whorl_texture
  95. texture {
  96.    noise surface {
  97.       color green
  98.       ambient 0.3
  99.       diffuse 0.8
  100.       lookup_fn lookup_sawtooth
  101.       octaves 2
  102.       turbulence 2
  103.       color_map(
  104.          [0.0, 0.3, green,   blue]
  105.          [0.3, 0.6, blue,    skyblue]
  106.          [0.6, 0.8, skyblue, orange]
  107.          [0.8, 1.0, orange,  red])
  108.       }
  109.    scale <0.5, 0.5, 0.5>
  110.    }
  111.  
  112. // Create a wood texture.  Concentric rings of color
  113. // are wrapped around the z-axis.  There is some turbulence
  114. // in order to keep the rings from looking too perfect.
  115. define light_wood <0.6, 0.24, 0.1>
  116. define median_wood <0.3, 0.12, 0.03>
  117. define dark_wood <0.05, 0.01, 0.005>
  118. define wooden
  119. texture {
  120.    noise surface {
  121.       position_fn position_cylindrical
  122.       position_scale 1
  123.       lookup_fn lookup_sawtooth
  124.       octaves 1
  125.       turbulence 1
  126.       ambient 0.2
  127.       diffuse 0.7
  128.       specular white, 0.5
  129.       microfacet Reitz 10
  130.       color_map(
  131.          [0.0, 0.2, light_wood, light_wood]
  132.          [0.2, 0.3, light_wood, median_wood]
  133.          [0.3, 0.4, median_wood, light_wood]
  134.          [0.4, 0.7, light_wood, light_wood]
  135.          [0.7, 0.8, light_wood, median_wood]
  136.          [0.8, 0.9, median_wood, light_wood]
  137.          [0.9, 1.0, light_wood, dark_wood])
  138.       }
  139.    }
  140.  
  141. // Define a texture using a color wheel
  142. define xz_wheel_texture
  143. texture {
  144.    special surface {
  145.       color color_wheel(x, y, z)
  146.       ambient 0.2
  147.       diffuse 0.8
  148.       specular white, 0.2
  149.       microfacet Reitz 10
  150.       }
  151.    }
  152.  
  153. // This is an example of a gradient texture.
  154. define mountain_colors
  155. texture {
  156.    noise surface {
  157.       ambient 0.2
  158.       diffuse 0.8
  159.       specular 0.2
  160.       position_fn position_objectx
  161.       color_map(
  162.          [-128,   0, blue,  blue]
  163.          [   0,  20, green, green]
  164.          [  20,  40, green, tan]
  165.          [  40,  90, tan,   tan]
  166.          [  90, 128, white, white])
  167.       }
  168.    rotate <0, 0, 90>
  169.    }
  170.  
  171. // This makes a nice texture to use on leaves
  172. define bumpy_green
  173. texture {
  174.    special surface {
  175.       normal N + dnoise(3*W)
  176.       ambient green, 0.2
  177.       diffuse green, 0.3
  178.       specular white, 0.7
  179.       microfacet Reitz 10
  180.       }
  181.    scale <0.02, 0.02, 0.02>
  182.    }
  183.  
  184. // Red dented/wrinkled appearance
  185. define dented_red
  186. texture {
  187.    noise surface {
  188.       color <1, 0.2, 0.2>
  189.       normal 1
  190.       frequency 2
  191.       bump_scale 3
  192.       ambient 0.2
  193.       diffuse 0.5
  194.       specular 0.7
  195.       microfacet Reitz 10
  196.       }
  197.    scale <0.2, 0.2, 0.2>
  198.    }
  199.  
  200. // When used on a big sphere, this makes a nice cloudy sky.  You will
  201. // probably need to scale to make it look good.
  202. define cloudy_sky
  203. texture {
  204.    noise surface {
  205.       ambient 0.9
  206.       diffuse 0
  207.       specular 0
  208.       turbulence 6.0
  209.       position_fn 2
  210.       lookup_fn 1
  211.       octaves 4
  212.       color_map(
  213.      [0.0, 0.6, <0.4, 0.4, 0.4>, <1, 1, 1>]
  214.      [0.6, 0.8, <1, 1, 1>, <0.196078, 0.6, 0.8>]
  215.      [0.8, 1.0, <0.196078, 0.6, 0.8>, <0.196078, 0.6, 0.8>])
  216.       }
  217.    }
  218.